<template>
	<view>
		<view style="margin-top: 30upx;text-align: center;">
			<view class="" style="display: flex;justify-content: center;margin-top: 30upx;">
				<view style="">
					当前剩余积分数量:
				</view>
				<view class="" style="margin-left: 30upx;">
					{{credit1}}
				</view>
			</view>
			<view class="" style="display: flex;justify-content: center;margin-top: 30upx;">
				<view style="">
					对方账号:
				</view>
				<view class="" style="margin-left: 30upx;">
					{{zzopenid}}
				</view>
			</view>
			<view class="" style="display: flex;justify-content: center;margin-top: 30upx;">
				<view style="">
					对方姓名:
				</view>
				<view class="" style="margin-left: 30upx;">
					{{realname}}
				</view>
			</view>
			<view class="" style="display: flex;justify-content: center;margin-top: 30upx;">
				<view class="" style="margin-top: 10upx;">
					请输入互转数量:
				</view>
				<input type="text" v-model="num" style="border: 1upx solid #000000;width: 20%;height: 60upx;margin-left: 30upx;"/>
			</view>
			<button type="default" @click="sub" style="width: 60%;margin-left: 20%;background-color: #EC5C53;color: #fff;margin-top: 30upx;">提交</button>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				openid:'',
				zzopenid:'',
				realname:'',
				num:'',
				credit1:'',
			}
		},
		onLoad:function(e){
			// console.log(e)
			this.realname = e.realname
			this.zzopenid = e.zzopenid
			this.credit1 = e.credit1
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
				},
				fail: () => {}
			});
			uni.hideLoading()
		},
		methods: {
			sub(){
				uni.request({
					url: 'https://app.t9y9y9.com/app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=member.hyhz.dozzks&app=1',
					method: 'POST',
					data: {
						'openid':this.openid,
						'zzopenid': this.zzopenid,
						 'num': this.num,
						},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res)
							if(res.data.status==1){
								setTimeout(()=>{
									uni.showToast({
										title : res.data.result.message,
										icon : 'none',
									})
								},500)
								uni.navigateTo({
									url:'/pages/commission/qrcode/hyhz'
								})
							}else{
								uni.showToast({
									title : res.data.result.message,
									icon : 'none',
								})
							}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			
			jump(e){
				uni.navigateTo({
					url: e.currentTarget.dataset.src
				});
			},
		}
	}
</script>

<style>
	page {
		background-color: #fff;
		}
	.btn {padding:20upx 0;}
	.btn button {margin:20upx 0;font-size:28upx;padding:12upx;}
	.btn .logout {border-color:#175e3c;background-image: linear-gradient(to bottom, rgb(243, 109, 31), rgb(252, 9, 9));color: #fff;}
	.uni-list {font-weight: 600;border-radius: 10upx; margin-top: 20upx;}
	.uni-list-cell {height: 100upx;line-height: 100upx;}
	.uni-list-cell.active {background:#f5f5f5;}
	.uni-list image {width:34upx;height:34upx;}
	.uni-list .text {position:absolute;left:44upx;font-size:26upx;top: 0;}
	.uni-list {margin-top:20upx;}
	.uni-list:before,.uni-list:after {display:none;}
	.uni-list-cell:after {content:" ";position:absolute;left:0.5rem;right:0.5rem;bottom:-1px;height:1px;border-top:1px solid #ebebeb;color:#D9D9D9;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(0.5);-ms-transform:scaleY(0.5);transform:scaleY(0.5);background:none;}
	.uni-list-cell .right {font-size:24upx;color:#999;margin-right:20upx;}
	.uni-list .uni-list-cell:last-child:after {border:0;}
	.uni-list .uni-badge {margin-right:15px;background-color:#f55;}
	.increase_width {width: 95%;margin: 0 auto;}
</style>
